package com.ctshk.rpc.tour.mapper;

import com.ctshk.common.service.mapper.CtsBaseMapper;
import com.ctshk.rpc.tour.base.CustomBaseMapper;
import com.ctshk.rpc.tour.entity.SeriesTripScheduleChannelOfflineSelfCustom;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 团期线下自营自定义权限 Mapper 接口
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-28
 */
public interface SeriesTripScheduleChannelOfflineSelfCustomMapper extends CustomBaseMapper<SeriesTripScheduleChannelOfflineSelfCustom>, CtsBaseMapper<SeriesTripScheduleChannelOfflineSelfCustom> {

    /**
     * 查询加幅规则
     * @param deptId
     * @param userId
     * @param scheduleId
     * @return
     */
    @Select("SELECT *\n" +
            "FROM t_series_trip_schedule_channel_offline_self_custom\n" +
            "WHERE schedule_id = #{schedule_id} AND is_deleted = 0 AND (check_type = 2 OR (check_type = 3 AND (relation_id = #{dept_id} OR relation_id = #{user_id}))) LIMIT 1")
    SeriesTripScheduleChannelOfflineSelfCustom queryByCondition(@Param("dept_id") Long deptId,@Param("user_id") Long userId, @Param("schedule_id")Long scheduleId);
}
